package 一六B;

import java.util.Vector;

/**
 * Created by lenovo on 2017/3/29.
 */
public class q7 {
    public static int count = 0;

    private static boolean check(Vector<Integer> result) {
        for (int i = 0; i < result.size(); i++) {
            int current = result.elementAt(i);
            if ((!result.contains(current - 1)) && (!result.contains(current + 1)) && (!result.contains(current - 4)) && (!result.contains(current + 4))) {
                return false;
            }
        }
        return true;
    }

    private static void fullPaiLie(Vector<Integer> source, Vector<Integer> result) {
        if (result.size() == 5) {
            if (check(result)) {
                count++;
            }
        }
        for (int i = 0; i < source.size(); i++) {
            Vector<Integer> tsource = new Vector<>(source);
            Vector<Integer> tresult = new Vector<>(result);
            tresult.add(source.elementAt(i));
            tsource.remove(i);
            fullPaiLie(tsource, tresult);
        }
    }

    public static void main(String[] args) {
        Vector<Integer> source = new Vector<>();
        Vector<Integer> result = new Vector<>();

        for (int i = 1; i <= 12; i++) {
            source.add(i);
        }
        fullPaiLie(source, result);
        System.out.println(count/120);
    }
}
